To fit a distribution to the rows and columns of pixel matrix in the baseline defect detection, we have started with two different approaches. In this part, we will try both approaches and choose one of them.

First Approach: Fitting a distribution for rows and column seperately by getting row averages and column averages. After obtaining these two distributions, out of control pixels are determined both row-vise and column-vise.

Second Approach: The pixel matrix is flattened and bought to the one dimensional array. Afterwards a distribution is fitted to the whole matrix and out of control situations are determined according to one distribution.

Below, we will first analyze the first approach by fitting a distribution to the row averages and column averages.

Row averages are fitted to a normal distribution and column averages are fitted to a mixture of normal (Gaussian) distribution. However, in that case, since we have fitted the distributions according to the averages, we don't have enough data for the approximation. Also, since the out of control pixels are determined both row-vise and column-vise, there are more than necessary out of control points which causes Type-2 error, false alarms. Therefore the second approach is taken by flattening the pixel matrix.

In the next cell, we have worked with only one distribution to determine out of control situations by converting the pixel matrix to 1D array.

By utilizing Mean: 205.93, Standard Deviation: 22.05 values, we will determine 0.001 probability limits by using inverse of normal distribution.

When the probability limits are set as 0.001, as one can see from the difference between modified image and original image, the defect cannot be detected. However, when the lower bound and upper bound is set as 130 and 210 (by trial and error), the defect can be seen easily as the output of the next cell suggested.

Here one can see that defect can be shown in the middle of image by correctly choosing lower bound and upper bound. For now, we have found it by trial and error, however, we will propose an algorithm with autoregressive model in the end.

To display patch-work, 3 sample patch detection is chosen randomly and shown with their modified versions. Afterwards, patches are combined and modified version is displayed.

To comment on the detection performance of the patch-work, we have expected it to be true in the first place because it calculated the mean and sigma values of the distribution of each patch and calculated the lower bound and upper bound accordingly. However, it didn't give a better performance as one can observe from the comparison between images above. Because our image doesn't have many different patches, the mean and standard deviation of different patches didn't vary among each other. That's why, patch-work didn't perform well as expected.

The second reason for the bad performance is that our probability limits are really small. In the next cell, the probability limits will be updated and the performance is a little bit higher.

When we decrease the probability limits, again it didn't detect the defect in the middle with the performance on the general 130 and 210 limits as we have shown above because the defect in the middle is most probably contained in a patch and this patch has a mean and standard deviation accordingly. Therefore, the limits corresponding to the patch containing defect couldn't detect the defect.

Another approach in defect detection could be analyzing the rows and columns seperately. In this approach, each row has its own parameters and each column has its own parameters correspondingly. In detail, we have constructed control charts for each row with its own mean and variance. Then, out of control pixels are detected and their values are changed to zero. The new image and the original one is displayed. This process is repeated for the columns as well. After understanding the simple summary of the process; now, we can delve deep into the it and gain some useful insights.

Above, for the row-based approach, out-of-control pixels are detected. 3 random control charts and their parameters are displayed.

Pixels with out-of-control values are changed to zero, in other words, to the black color. The defect in the middle of the image becomes much more visible as we mark the out-of-control pixels with black.

Following that, for the column-based approach, the process is very much similar.

Above, for the column-based approach, out-of-control pixels are detected. 3 random control charts and their parameters are displayed.

Pixels with out-of-control values are changed to zero, in other words, to the black color. The defect in the middle of the image becomes much more visible as we mark the out-of-control pixels with black.

Finally, we can focus on the similarity between the row-based and column-based approach. To do so, we utilized 2 different methods. The first one is the usual calculation of the correlation between the both image matrices. The second one utilizes the "Structural Similarity Index" which is particularly used for comparing images.

As one can see from the both methods, the 2 images acquired from the both approaches are very much similar to each other. Yet, there is a little difference that may have been arisen from various reasons. The row-based approach focuses on capturing horizontal defects across the fabric. So, it identifies flaws such as horizontal tears, thread breaks or weaving irregularities. However, the row-based approach may fail to detect flaws such as irregularities in the weave pattern, or vertical thread misalignments which are expected to be seen by a column-based approach. Since our linen fabric does not have such a specific defect (not specific to a row or a column), the created images do not differ in a significant manner. Yet, incase of an examination of another piece of fabric, utilizing both the row-based and column-based approaches might be very much helpful in detect defection.

165, 30, 8, 191, 72 are available